package com.kongxx.struts2study.user.web.action;

import com.kongxx.struts2study.common.web.action.BaseAction;
import com.kongxx.struts2study.user.model.User;
import com.kongxx.struts2study.user.service.UserService;

public class UserEditAction extends BaseAction {
	
	private static final long serialVersionUID = 1L;
	
	private User user;
	
	private UserService userService;
	
	public String toEdit() throws Exception {
		user = userService.find(user.getId());
		return SUCCESS;
	}
	
	public String doEdit() throws Exception {
		userService.update(user);
		return SUCCESS;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}
}
